package arrays;

import java.util.Scanner;

public class arrays_11 {
    public static void main (String [] args ){
        Scanner scanner = new Scanner(System.in) ;
        String user ;
        int x = 0 ;
        int y ;
        boolean flag = true ;

            while (flag) {
                System.out.println("请输入你的选择：");
                user = scanner.nextLine();
                switch (user) {
                    case "石头":
                        x = 1;
                        flag = false;
                        break;
                    case "剪刀":
                        x = 2;
                        flag = false;
                        break;
                    case "布":
                        x = 3;
                        flag = false;
                        break;
                    default:
                        System.out.println("输入有误！");
                        flag = true;
                }
            }
            y = (int) (3 * Math.random()) + 1;
            switch (y) {
                case 1:
                    System.out.println("电脑出了 石头 ！");
                    ;
                    break;
                case 2:
                    System.out.println("电脑出了 剪刀 ！");
                    break;
                case 3:
                    System.out.println("电脑出了 布 ！");
                    break;
                default:
                    ;
            }
            if (x == y) {
                System.out.println("平局！");
            } else if ((x == 1 && y == 2) || (x == 2 && y == 3) || x == 3 && y == 1) {
                System.out.println("恭喜，你赢了！");
            } else {
                System.out.println("好可惜，你输了了！");
            }



    }
}
